package com.wangtao.netty.http;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;


public class TestServerInit extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();

        //http编解码器
        pipeline.addLast("MyHttpServerCodec", new HttpServerCodec());

        //自定义处理器
        ch.pipeline().addLast("MyTestServerHandler",new TestServerHandler());

        System.out.println("ok。。。");
    }
}
